package com.lwj.liwanjia.adapter;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.lwj.liwanjia.R;
import com.superrecycleview.superlibrary.adapter.BaseViewHolder;
import com.superrecycleview.superlibrary.adapter.SuperBaseAdapter;

import java.util.List;

/**
 * Created by Administrator on 2017/10/2.
 */

public class AddAdapter extends SuperBaseAdapter<String> {
    private Context mContext;
    private boolean flag;

    public AddAdapter(Context context, List<String> data) {
        super(context, data);
        this.mContext = context;
        flag = true;
    }

    @Override
    protected void convert(BaseViewHolder holder, String item, int position) {
        holder.setOnClickListener(R.id.iv_cancle, new OnItemChildClickListener());
        Glide.with(mContext).load(item).into((ImageView) holder.getView(R.id.iv_add));
        holder.setVisible(R.id.iv_cancle, flag);
    }

    @Override
    protected int getItemViewLayoutId(int position, String item) {
        return R.layout.add_item;
    }

    public void setCancleEnable(boolean flag) {
        this.flag = flag;
        notifyDataSetChanged();
    }
}
